package rolesystem.roles.auction;

import rolesystem.core.RoleAction;
import rolesystem.roles.KnownEvent;

/**
 * This role is the bidder of an auction.
 * Keywords: auction, bidder.
 */
public abstract class Bidder
{
	/**
	 * Role identifier.
	 */
	public static final String ROLE_ID="auction.Bidder";


	/**
	 * An auctioneer notifies the kind of the auction.
	 * Sender role: Auctioneer
	 * Content: Kind of the auction (English, Dutch...).
	 */
	public static final KnownEvent KE_notifyKind=new KnownEvent("notifyKind", Auctioneer.ROLE_ID, String.class);

	/**
	 * An auctioneer notifies the good on sale.
	 * Sender role: Auctioneer
	 * Content: Description of the good on sale.
	 */
	public static final KnownEvent KE_notifyGood=new KnownEvent("notifyGood", Auctioneer.ROLE_ID, String.class);

	/**
	 * An auctioneer notifies the current situation of the auction.
	 * Sender role: Auctioneer
	 * Content: Situation of the auction, i.e. proposed price, winning bidder and countdown state.
	 */
	public static final KnownEvent KE_notifySituation=new KnownEvent("notifySituation", Auctioneer.ROLE_ID, Situation.class);

	/**
	 * An auctioneer notifies that the auction is over.
	 * Sender role: Auctioneer
	 */
	public static final KnownEvent KE_auctionOver=new KnownEvent("auctionOver", Auctioneer.ROLE_ID);

	/**
	 * An auctioneer notifies that I have won the auction and thus I must pay.
	 * Sender role: Auctioneer
	 * Content: Price that must be paid.
	 */
	public static final KnownEvent KE_youWon=new KnownEvent("youWon", Auctioneer.ROLE_ID, Price.class);

	/**
	 * An auctioneer gives a good.
	 * Sender role: Auctioneer
	 * Content: Good.
	 */
	public static final KnownEvent KE_giveGood=new KnownEvent("giveGood", Auctioneer.ROLE_ID, java.io.Serializable.class);

	/**
	 * Another bidder talks.
	 * Sender role: Bidder
	 * Content: Message.
	 */
	public static final KnownEvent KE_talk=new KnownEvent("talk", Bidder.ROLE_ID, String.class);


	/**
	 * Asks the kind of the auction (English, Dutch...).
	 * @param addressee Auctioneer
	 */
	public static RoleAction askKind(int addressee)
	{
		return new RoleAction("askKind", addressee);
	}

	/**
	 * Asks the description of the good on sale.
	 * @param addressee Auctioneer
	 */
	public static RoleAction askGood(int addressee)
	{
		return new RoleAction("askGood", addressee);
	}

	/**
	 * Asks the current situation of the auction.
	 * @param addressee Auctioneer
	 */
	public static RoleAction askSituation(int addressee)
	{
		return new RoleAction("askSituation", addressee);
	}

	/**
	 * Makes a bid.
	 * @param addressee Auctioneer
	 * @param content Bid.
	 */
	public static RoleAction bid(int addressee, Price content)
	{
		return new RoleAction("bid", addressee, content);
	}

	/**
	 * Pays.
	 * @param addressee Auctioneer
	 * @param content Payment.
	 */
	public static RoleAction pay(int addressee, Money content)
	{
		return new RoleAction("pay", addressee, content);
	}

	/**
	 * Talks.
	 * @param addressee Bidder
	 * @param content Message.
	 */
	public static RoleAction talk(int addressee, String content)
	{
		return new RoleAction("talk", addressee, content);
	}
}
